﻿<Window x:Class="ChatDemo.Connection"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:viewModel="clr-namespace:ChatDemo.ViewModel"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        mc:Ignorable="d"
        Title="Connection" MaxWidth="400" 
        SizeToContent="WidthAndHeight" MinWidth="300"
        d:DataContext="{d:DesignInstance Type=viewModel:ChatViewModel}" ResizeMode="CanMinimize" WindowStartupLocation="CenterOwner"
        Loaded="Window_Loaded"
  >
  <Grid>
    <Grid.Resources>
      <Style TargetType="TextBox">
        <Setter Property="FontSize" Value="12"/>
        <Setter Property="Margin" Value="12,3,12,12"/>
      </Style>

      <Style TargetType="TextBlock">
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey={x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
        <Setter Property="FontSize" Value="12"/>
        <Setter Property="Margin" Value="12,3"/>
      </Style>

      <Style x:Key="Title" TargetType="TextBlock">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
        <Setter Property="FontSize" Value="32"/>
        <Setter Property="Margin" Value="12,3"/>
        <Setter Property="FontFamily" Value="Segoe UI Light" />
      </Style>


      <Style TargetType="Button">
        <Setter Property="Margin" Value="12"/>
        <Setter Property="Padding" Value="3"/>
      </Style>
    </Grid.Resources>

    <StackPanel x:Name="UserInput" Visibility="Visible" >
      <TextBlock Text="Connection details" Style="{StaticResource Title}"/>
      <TextBlock Text="Your address"/>
      <TextBox IsReadOnly="True" BorderThickness="0" Text="{Binding ThisConnection, Mode=OneWay}"/>
      <TextBlock Text="Address to connect to"/>
      <TextBox Text="{Binding ConnectTo}" />
      <Button Content="Connect" HorizontalAlignment="Right" Click="ConnectButton_Click"/>
      <TextBlock Text="{Binding Error}" TextWrapping="Wrap" Foreground="Red"/>
    </StackPanel>
    <StackPanel x:Name="connecting" Visibility="Hidden">
      <TextBlock Text="Connecting..." Style="{StaticResource Title}"/>
      <ProgressBar Height="32" Margin="32" IsIndeterminate="True"/>

    </StackPanel>
  </Grid>
</Window>
